<html>
<head>
    <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
    <meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge"/>
    <script type="text/javascript" src="../../../../x3dom-include.js"></script>
</head>
<body>
<script>
    function clickedLeft(event){
        document.getElementById('pc').setAttribute('destination', event.hitPnt);
        document.getElementById('oc').setAttribute('destination', '0.86 0.36 -0.36 1.71');
        document.getElementById('cc').setAttribute('destination', '1 1 0');
    }
    function clickedRight(event){
        document.getElementById('pc').setAttribute('destination', event.hitPnt);
        document.getElementById('oc').setAttribute('destination', '0.86 -0.36 0.36 1.71');
        document.getElementById('cc').setAttribute('destination', '0 0 1');
    }
</script>

<x3d id='x3d' showLog='true' width='800px' height='600px'>
    <scene DEF='scene'>
        <viewpoint position='0 0 5'></viewpoint>

        <transform DEF='marker' scale='0.2 0.2 0.2' center='0 0 0'>
            <shape>
                <appearance>
                    <material id='mat' diffuseColor='yellow'></material>
                </appearance>
                <cone></cone>
            </shape>
        </transform>

        <positionChaser id='pc' duration="1.5" initialDestination="0 -1 0" initialValue="0 0 0">
        </positionChaser>
        <orientationChaser id='oc' duration="1.5" initialDestination="0 0 1 0" initialValue="0 0 1 0.75">
        </orientationChaser>
        <colorChaser id='cc' duration="1.5" initialDestination="1 1 0" initialValue="1 1 0">
        </colorChaser>

        <route fromNode='pc' fromField='value_changed' toNode='marker' toField='translation'></route>
        <route fromNode='oc' fromField='value_changed' toNode='marker' toField='rotation'></route>
        <route fromNode='cc' fromField='value_changed' toNode='mat' toField='diffuseColor'></route>

        <transform onclick="clickedLeft(event);"
                   rotation='0 1 0 0.785' translation='-1 0 0'>
            <shape>
                <appearance>
                    <material diffuseColor='red'></material>
                </appearance>
                <indexedFaceSet DEF='plane' solid='false' creaseAngle="3" coordIndex='2 0 3 -1 3 0 1 -1'>
                    <coordinate point='-1 -1 0 1 -1 0 -1 1 0 1 1 0'></coordinate>
                    <normal vector='0 0 1 0 0 1 0 0 1 0 0 1'></normal>
                </indexedFaceSet>
            </shape>
        </transform>

        <transform onclick="clickedRight(event);"
                   rotation='0 1 0 -0.785' translation='1 0 0'>
            <shape>
                <appearance>
                    <material diffuseColor='green'></material>
                </appearance>
                <indexedFaceSet USE='plane'>
                </indexedFaceSet>
            </shape>
        </transform>
    </scene>
</x3d>
</body>
</html>
